# Maintainer: Alexey Pavlov <Alexpux@gmail.com>

_realname=mpc
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.2.1
pkgrel=1
pkgdesc="Multiple precision complex arithmetic library (mingw-w64)"
url='http://www.multiprecision.org'
license=('LGPL')
arch=('any')
depends=("${MINGW_PACKAGE_PREFIX}-mpfr")
makedepends=("${MINGW_PACKAGE_PREFIX}-gmp" "${MINGW_PACKAGE_PREFIX}-mpfr")
options=('staticlibs' '!emptydirs')
source=(#"http://www.multiprecision.org/mpc/download/${_realname}-${pkgver}.tar.gz"
        https://ftp.gnu.org/gnu/mpc/${_realname}-${pkgver}.tar.gz{,.sig})
sha256sums=('17503d2c395dfcf106b622dc142683c1199431d095367c6aacba6eec30340459'
            'SKIP')
validpgpkeys=('AD17A21EF8AED8F1CC02DBD9F7D5C9BF765C61E3')

build() {
  [[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
  mkdir -p ${srcdir}/build-${MINGW_CHOST} && cd ${srcdir}/build-${MINGW_CHOST}
  ../${_realname}-${pkgver}/configure \
     --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --enable-static \
    --disable-shared \
    --with-gmp=${MINGW_PREFIX} \
    --with-mpfr=${MINGW_PREFIX}
  make
}

check() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make check || true
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
